{% extends 'moblie_base.html' %}

{% block title %}
Brenden Jeon
{% endblock %}
{% block stylesheet %}
{{ block.super }}
{% endblock%}

{% block javascript %}
{{ block.super }}
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript">
$(document).ready(function () {
    function success(position) {
        {% for l in objects_page.object_list %}
        var latlng = new google.maps.LatLng({{ l.geoPoint.lat }}, {{ l.geoPoint.lon }});
        {% endfor %}
        var myOptions = {
            zoom: 15,
            center: latlng,
            mapTypeControl: false,
            navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };

        var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
        var markers = [];

        {% for l in objects_page.object_list %}
        var marker{{ forloop.counter }} = new google.maps.Marker({
            position: new google.maps.LatLng({{ l.geoPoint.lat }}, {{ l.geoPoint.lon }}),
            map: map,
            title:"{{ l.date }}"
        });
        markers[{{ forloop.counter }}] = marker{{ forloop.counter }};
        {% endfor %}
    }

    function error(msg) {
        if(msg != ""){
            alert(msg);
        } else {
            alert("Something wrong");
        }
    }

    if (navigator.geolocation) {
        navigator.geolocation.getCurrentPosition(success, error);
    } else {
        error('not supported');
    }
});
</script>
{% endblock%}

{% block content %}
<div id="content">
    <div id="map_canvas" style="width: 350px; height: 300px"></div>
</div>
<div id="sidebar">
    {% for l in objects_page.object_list %}
    {{ l.comment }}
    {% endfor %}
{% if has_previous %}
    <span class="page"><a href="{{ request.path }}?page={{ previous }}&{{ url_arguments.encode_without_page }}">&lt; Prev</a></span>
{% endif %}

{% if has_next %}
    <span class="page"><a href="{{ request.path }}?page={{ next }}&{{ url_arguments.encode_without_page }}">Next &gt;</a></span>
{% endif %}
</div>
{% endblock %}
